#include "mainwindow.h"
#include <QApplication>
#include <QFile>
#include "glwidget.h"
#include "shapereviewer.h"

int main(int argc, char* argv[])
{
    // 初始化Qt应用，必须启用OpenGL支持
    QApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
    QApplication a(argc, argv);

    // 创建球体查看器实例
    ShapereViewer viewer;
    viewer.setWindowTitle("3D Textured Sphere (Qt + VTK)");
    viewer.resize(800, 800);

    // 加载纹理图片
    QString texturePath = "C:/Users/taihe/Desktop/earth.jpg";
    bool loadSuccess = viewer.loadTexture(texturePath);
    if (!loadSuccess) {
        return -1;
    }
    // 显示窗口
    viewer.show();

    //GLWidget widget;
    //widget.setWindowTitle("OpenGL Textured Sphere");
    //widget.resize(800, 800);
    //widget.show();

    return a.exec();  // 仅启动Qt事件循环，无需再调用VTK的Start()
}
